package com.zy.cyan.utils;

import java.io.File;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class CommonUtil {
	// 获得相册内的文件
	public static JSONArray getPicturesPath(String basePath) {
		JSONArray albumResource = new JSONArray();
		File[] resoures = new File(basePath).listFiles();
		for (File file : resoures) {
			String path = file.getPath();
			String fileName = file.getName().toLowerCase();
			if (fileName.endsWith("jpg") || fileName.endsWith("bmp")
					|| fileName.endsWith("png")) {
				JSONObject obj = new JSONObject();
				path = path.substring(path.indexOf("\\CyanZhong"));
				obj.put("path", path);
				albumResource.add(obj);
			}
		}
		return albumResource;
	}
}
